home *** CD-ROM | disk | FTP | other *** search
/ Visual Intercept / Visual Intercept.iso / sheriff.z / issherff.frm < prev    next >
Text File  |  1996-08-26  |  10KB  |  346 lines

  1. VERSION 4.00
  2. Begin VB.Form ISSHERIFF 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Incident Form Title"
  5.    ClientHeight    =   5400
  6.    ClientLeft      =   1470
  7.    ClientTop       =   1800
  8.    ClientWidth     =   6630
  9.    Height          =   5805
  10.    Left            =   1410
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   360
  13.    ScaleMode       =   3  'Pixel
  14.    ScaleWidth      =   442
  15.    Top             =   1455
  16.    Width           =   6750
  17.    Begin VB.TextBox txtDescription 
  18.       BackColor       =   &H00FFFFFF&
  19.       ForeColor       =   &H00000000&
  20.       Height          =   2655
  21.       Left            =   240
  22.       MultiLine       =   -1  'True
  23.       ScrollBars      =   2  'Vertical
  24.       TabIndex        =   7
  25.       Top             =   1920
  26.       Width           =   6135
  27.    End
  28.    Begin VB.TextBox txtSubject 
  29.       BackColor       =   &H00FFFFFF&
  30.       ForeColor       =   &H00000000&
  31.       Height          =   330
  32.       Left            =   240
  33.       MultiLine       =   -1  'True
  34.       TabIndex        =   6
  35.       Top             =   1200
  36.       Width           =   6135
  37.    End
  38.    Begin VB.ComboBox AvailableProjects 
  39.       BackColor       =   &H00FFFFFF&
  40.       BeginProperty Font 
  41.          name            =   "MS Sans Serif"
  42.          charset         =   0
  43.          weight          =   700
  44.          size            =   8.25
  45.          underline       =   0   'False
  46.          italic          =   0   'False
  47.          strikethrough   =   0   'False
  48.       EndProperty
  49.       Height          =   300
  50.       Left            =   240
  51.       Style           =   2  'Dropdown List
  52.       TabIndex        =   2
  53.       Top             =   480
  54.       Width           =   6135
  55.    End
  56.    Begin VB.CommandButton cmdSend 
  57.       Caption         =   "Send"
  58.       BeginProperty Font 
  59.          name            =   "Arial"
  60.          charset         =   0
  61.          weight          =   700
  62.          size            =   8.25
  63.          underline       =   0   'False
  64.          italic          =   0   'False
  65.          strikethrough   =   0   'False
  66.       EndProperty
  67.       Height          =   375
  68.       Left            =   1560
  69.       TabIndex        =   1
  70.       Top             =   4800
  71.       Width           =   1335
  72.    End
  73.    Begin VB.CommandButton cmdClose 
  74.       Caption         =   "Cancel"
  75.       BeginProperty Font 
  76.          name            =   "Arial"
  77.          charset         =   0
  78.          weight          =   700
  79.          size            =   8.25
  80.          underline       =   0   'False
  81.          italic          =   0   'False
  82.          strikethrough   =   0   'False
  83.       EndProperty
  84.       Height          =   375
  85.       Left            =   3600
  86.       TabIndex        =   0
  87.       Top             =   4800
  88.       Width           =   1335
  89.    End
  90.    Begin VB.Label Label3 
  91.       Caption         =   "Description"
  92.       BeginProperty Font 
  93.          name            =   "MS Sans Serif"
  94.          charset         =   0
  95.          weight          =   700
  96.          size            =   8.25
  97.          underline       =   0   'False
  98.          italic          =   0   'False
  99.          strikethrough   =   0   'False
  100.       EndProperty
  101.       Height          =   255
  102.       Left            =   240
  103.       TabIndex        =   5
  104.       Top             =   1680
  105.       Width           =   1335
  106.    End
  107.    Begin VB.Label Label2 
  108.       Caption         =   "Subject"
  109.       BeginProperty Font 
  110.          name            =   "MS Sans Serif"
  111.          charset         =   0
  112.          weight          =   700
  113.          size            =   8.25
  114.          underline       =   0   'False
  115.          italic          =   0   'False
  116.          strikethrough   =   0   'False
  117.       EndProperty
  118.       Height          =   255
  119.       Left            =   240
  120.       TabIndex        =   4
  121.       Top             =   960
  122.       Width           =   975
  123.    End
  124.    Begin VB.Label Label1 
  125.       Caption         =   "Project"
  126.       BeginProperty Font 
  127.          name            =   "MS Sans Serif"
  128.          charset         =   0
  129.          weight          =   700
  130.          size            =   8.25
  131.          underline       =   0   'False
  132.          italic          =   0   'False
  133.          strikethrough   =   0   'False
  134.       EndProperty
  135.       Height          =   255
  136.       Left            =   240
  137.       TabIndex        =   3
  138.       Top             =   240
  139.       Width           =   855
  140.    End
  141. End
  142. Attribute VB_Name = "ISSHERIFF"
  143. Attribute VB_Creatable = False
  144. Attribute VB_Exposed = False
  145. '----------------------------------------------------------------------------
  146. '   issherff.frm is a member of the Visual Intercept Visual Basic API.
  147. '   Copyright (c) 1996 Elsinore Technologies, Inc. All rights reserved.
  148. '
  149. '   This software is protected by copyright law. Unauthorized reproduction
  150. '   or distribution of this program, or any portion of it, may result in
  151. '   severe civil or criminal penalties. If you have any questions about
  152. '   your redistribution rights, please contact Elsinore Technologies, Inc.
  153. '
  154. '   Creator: Albert J. Lin (AJL)
  155. '   History: Created 09/17/95
  156. '----------------------------------------------------------------------------
  157.  
  158.  
  159. '============================================
  160. ' Visual Intercept Sheriff global definitions
  161. '============================================
  162. Private gSheriffRecord As ISSheriffRecord    ' Configuration information
  163.     
  164.  
  165.  
  166. Private Function EnableState()
  167.     Dim bEnable As Boolean
  168.     Dim text As String
  169.     
  170.     bEnable = True
  171.    
  172. ' Determine if we can Send the incident yet
  173. ' A subject, description, and project must be specified
  174.     If AvailableProjects.ListCount = 0 Then
  175.         bEnable = False
  176.     Else
  177.         If AvailableProjects.ListIndex = -1 Then
  178.             bEnable = False
  179.         Else
  180.             text = Trim(txtSubject.text)
  181.             If Len(text) = 0 Then
  182.                 bEnable = False
  183.             Else
  184.                 text = Trim(txtDescription.text)
  185.                 If Len(text) = 0 Then
  186.                     bEnable = False
  187.                 End If
  188.             End If
  189.         End If
  190.     End If
  191.     
  192.     cmdSend.Enabled = bEnable
  193.     
  194. End Function
  195.  
  196. Private Function Finished()
  197.     MousePointer = cursorWait
  198.     Unload Me
  199.     MousePointer = cursorNormal
  200. End Function
  201.  
  202. Private Function LoadIncident(ByRef rIncident As VIIncident)
  203.     ' This method goes through the form and collects the incident
  204.     ' submission information.
  205.     Dim projectName As String
  206.     Dim nTotal As Integer
  207.     Dim nIndex As Integer
  208.     
  209.     ' Get the project information from the form
  210.     ' We must loop through looking for a match in case the user decides
  211.     ' to change the sort order of the project list box.
  212.     nIndex = AvailableProjects.ListIndex        ' Get the selected project
  213.     projectName = AvailableProjects.List(nIndex) ' Get the project name to search with
  214.     nTotal = AvailableProjects.ListCount        ' Get the number of projects available
  215.     
  216.     For nIndex = 0 To nTotal - 1    ' loop through original looking for match
  217.         If StrComp(projectName, gSheriffRecord.projects(nIndex).name, 1) = 0 Then
  218.             rIncident.projectName = gSheriffRecord.projects(nIndex).name
  219.             rIncident.versionName = gSheriffRecord.projects(nIndex).version
  220.             rIncident.assignedID = gSheriffRecord.projects(nIndex).leadID
  221.             Exit For
  222.         End If
  223.     Next nIndex
  224.      
  225. ' Get the dynamic input information from the form
  226.     rIncident.subject = txtSubject
  227.     rIncident.description = txtDescription
  228.  
  229. ' Load the default data from the IIRecord
  230.     rIncident.requesterID = gSheriffRecord.requesterID
  231.     If Len(rIncident.assignedID) = 0 Then                   ' if no project lead
  232.         rIncident.assignedID = gSheriffRecord.assignedID    ' use developer who executed Add-in
  233.     End If
  234.     rIncident.category = gSheriffRecord.category
  235.     rIncident.status = gSheriffRecord.status
  236.     rIncident.priority = gSheriffRecord.priority
  237.     rIncident.severity = gSheriffRecord.severity
  238.     
  239. End Function
  240.  
  241.  
  242.  
  243.  
  244.  
  245. Private Sub AvailableProjects_Click()
  246.     EnableState
  247. End Sub
  248.  
  249.  
  250. Private Sub cmdClose_Click()
  251.     Finished
  252. End Sub
  253.  
  254.  
  255. Private Sub cmdClose_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  256.     MousePointer = 11    ' Change mouse pointer to hourglass.
  257.  
  258. End Sub
  259.  
  260.  
  261. Private Sub cmdClose_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  262.     MousePointer = 0
  263.  
  264. End Sub
  265.  
  266. Private Sub cmdSend_Click()
  267.     Dim parameters As VILogonParameters
  268.     Dim incident As VIIncident
  269.     Dim err As Long
  270.     Dim exitErr As Long
  271.     
  272.     err = 0
  273.     
  274.     MousePointer = cursorWait
  275.     
  276. ' Initialize logon parameters
  277.     parameters.server = gSheriffRecord.server
  278.     parameters.userID = gSheriffRecord.userID
  279.     parameters.password = gSheriffRecord.password
  280.     parameters.systemUserID = gSheriffRecord.systemUserID
  281.     parameters.systemPassword = gSheriffRecord.systemPassword
  282.     
  283.     parameters.data = 0
  284.     parameters.options = gSheriffRecord.options + viSilent
  285.     parameters.hWnd = 0
  286.     
  287. ' Initialize the incident and fill in appropriate information
  288.     Call LoadIncident(incident)
  289.    
  290. ' Logon Visual Intercept and send the Incident
  291.     err = VBIILogon(parameters)
  292.     If err = 0 Then
  293.         err = VBIIInsertIncident(incident)
  294.         exitErr = VBIILogoff()
  295.     End If
  296.     
  297.     VBIIError (err)
  298.  
  299.     MousePointer = cursorNormal
  300.     
  301.     Finished
  302.     
  303. End Sub
  304.  
  305.  
  306.  
  307.  
  308. Private Sub Form_Load()
  309.     Dim nIndex As Long
  310.     Dim nProjects As Long
  311.     
  312.     Call VBIILoadRecord(gSheriffRecord)
  313.  
  314. 'Set the form title
  315.     Me.Caption = gSheriffRecord.formTitle
  316.     
  317. 'Clean out any previous references
  318.     AvailableProjects.Clear
  319.     
  320. 'Load up available projects
  321.     nProjects = gSheriffRecord.nProjects
  322.     For nIndex = 0 To nProjects - 1
  323.         AvailableProjects.AddItem gSheriffRecord.projects(nIndex).name
  324.     Next nIndex
  325.     
  326. 'Default to the first project
  327.     AvailableProjects.ListIndex = 0
  328.     
  329. End Sub
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336. Private Sub txtDescription_KeyUp(KeyCode As Integer, Shift As Integer)
  337.     EnableState
  338. End Sub
  339.  
  340.  
  341. Private Sub txtSubject_KeyUp(KeyCode As Integer, Shift As Integer)
  342.     EnableState
  343. End Sub
  344.  
  345.  
  346.